<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>启动播放器 | 简介</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../part0/handle_video_ratio.html" />
    
    
    <link rel="prev" href="../part0/demoyun_xing_xiao_guo_ji_shi_yong.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="1.3"
        data-chapter-title="启动播放器"
        data-filepath="part0/get_start_play.md"
        data-basepath=".."
        data-revision="Thu Apr 14 2016 20:52:34 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="part0/index.html">
            
                
                    <a href="../part0/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        快速开始
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="part0/import_project.html">
            
                
                    <a href="../part0/import_project.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        集成工程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="part0/demoyun_xing_xiao_guo_ji_shi_yong.html">
            
                
                    <a href="../part0/demoyun_xing_xiao_guo_ji_shi_yong.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        demo运行效果及使用
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="1.3" data-path="part0/get_start_play.html">
            
                
                    <a href="../part0/get_start_play.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        启动播放器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="part0/handle_video_ratio.html">
            
                
                    <a href="../part0/handle_video_ratio.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        处理视频比例
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="part0/handle_video_view_change.html">
            
                
                    <a href="../part0/handle_video_view_change.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        处理屏幕旋转
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="part0/pano_quick_start.html">
            
                
                    <a href="../part0/pano_quick_start.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        全景播放
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="part0/hanlde_proguard.html">
            
                
                    <a href="../part0/hanlde_proguard.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        关于混淆
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="part1/index.html">
            
                
                    <a href="../part1/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        第一章
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="part1/player_structure.html">
            
                
                    <a href="../part1/player_structure.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        播放器基本架构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="part1/player_api_Intro.html">
            
                
                    <a href="../part1/player_api_Intro.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        LetvPlayer播放器API说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="part1/playcontext_introduction.html">
            
                
                    <a href="../part1/playcontext_introduction.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        PlayContext ApI说明
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="download/download_module.html">
            
                
                    <a href="../download/download_module.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        下载模块
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="download/download_letter.html">
            
                
                    <a href="../download/download_letter.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        快速接入
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="download/download_center.html">
            
                
                    <a href="../download/download_center.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        DownloadCenter API说明文档
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="download/download_observer.html">
            
                
                    <a href="../download/download_observer.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        LeDownloadObserver API说明文档
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="download/download_info.html">
            
                
                    <a href="../download/download_info.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        LeDownloadInfo API 说明文档
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="update.html">
            
                
                    <a href="../update.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        更新说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="fqa.html">
            
                
                    <a href="../fqa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Q&amp;A
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >简介</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x542F;&#x52A8;&#x64AD;&#x653E;&#x5668;">&#x542F;&#x52A8;&#x64AD;&#x653E;&#x5668;</h1>
<h3 id="&#x83B7;&#x53D6;&#x4E50;&#x89C6;&#x4E91;&#x70B9;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;&#xFF08;&#x7565;&#xFF09;">&#x83B7;&#x53D6;&#x4E50;&#x89C6;&#x4E91;&#x70B9;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;&#xFF08;&#x7565;&#xFF09;</h3>
<blockquote>
<p>&#x672C;&#x6587;&#x5047;&#x8BBE;&#x7528;&#x6237;&#x5DF2;&#x7ECF;&#x83B7;&#x53D6;&#x5230;&#x4E86;&#x4E50;&#x89C6;&#x4E91;&#x70B9;&#x64AD;&#x6240;&#x9700;&#x8981;&#x7684;&#x53C2;&#x6570;</p>
</blockquote>
<h3 id="&#x83B7;&#x53D6;&#x4E50;&#x89C6;&#x4E91;&#x76F4;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;&#xFF08;&#x7565;&#xFF09;">&#x83B7;&#x53D6;&#x4E50;&#x89C6;&#x4E91;&#x76F4;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;&#xFF08;&#x7565;&#xFF09;</h3>
<blockquote>
<p>&#x672C;&#x6587;&#x5047;&#x8BBE;&#x7528;&#x6237;&#x5DF2;&#x7ECF;&#x83B7;&#x53D6;&#x5230;&#x4E86;&#x4E50;&#x89C6;&#x4E91;&#x76F4;&#x64AD;&#x6240;&#x9700;&#x8981;&#x7684;&#x53C2;&#x6570;</p>
</blockquote>
<h3 id="&#x83B7;&#x53D6;&#x4E50;&#x89C6;&#x4E91;&#x6D3B;&#x52A8;&#x76F4;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;&#xFF08;&#x7565;&#xFF09;">&#x83B7;&#x53D6;&#x4E50;&#x89C6;&#x4E91;&#x6D3B;&#x52A8;&#x76F4;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;&#xFF08;&#x7565;&#xFF09;</h3>
<blockquote>
<p>&#x672C;&#x6587;&#x5047;&#x8BBE;&#x7528;&#x6237;&#x5DF2;&#x7ECF;&#x83B7;&#x53D6;&#x5230;&#x4E86;&#x4E50;&#x89C6;&#x4E91;&#x6D3B;&#x52A8;&#x76F4;&#x64AD;&#x6240;&#x9700;&#x8981;&#x7684;&#x53C2;&#x6570;</p>
</blockquote>
<h1 id="&#x521D;&#x59CB;&#x5316;&#x4E50;&#x89C6;&#x4E91;&#x670D;&#x52A1;">&#x521D;&#x59CB;&#x5316;&#x4E50;&#x89C6;&#x4E91;&#x670D;&#x52A1;</h1>
<p>&#x5728;<code>Application</code>&#x4E2D;&#x521D;&#x59CB;&#x5316;&#x4E50;&#x89C6;&#x4E91;&#x670D;&#x52A1;&#xFF0C;&#x4FDD;&#x8BC1;&#x7A0B;&#x5E8F;&#x5F00;&#x542F;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x670D;&#x52A1;&#x5DF2;&#x7ECF;&#x6210;&#x529F;&#x521D;&#x59CB;&#x5316;&#x5B8C;&#x6BD5;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MApplication</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Application</span> </span>{


    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> String <span class="hljs-title">getProcessName</span><span class="hljs-params">(Context cxt, <span class="hljs-keyword">int</span> pid)</span> </span>{
        ActivityManager am = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE);
        List&lt;RunningAppProcessInfo&gt; runningApps = am.getRunningAppProcesses();
        <span class="hljs-keyword">if</span> (runningApps != <span class="hljs-keyword">null</span>) {
            <span class="hljs-keyword">for</span> (RunningAppProcessInfo procInfo : runningApps) {
                <span class="hljs-keyword">if</span> (procInfo.pid == pid) {
                    <span class="hljs-keyword">return</span> procInfo.processName;
                }
            }
        }
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">null</span>;
    }

    <span class="hljs-annotation">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onCreate</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">super</span>.onCreate();
        String processName = getProcessName(<span class="hljs-keyword">this</span>, android.os.Process.myPid());
        <span class="hljs-keyword">if</span> (getApplicationInfo().packageName.equals(processName)) {
            <span class="hljs-comment">//TODO CrashHandler&#x662F;&#x4E00;&#x4E2A;&#x6293;&#x53D6;&#x5D29;&#x6E83;log&#x7684;&#x5DE5;&#x5177;&#x7C7B;&#xFF08;&#x53EF;&#x9009;&#xFF09;</span>
            CrashHandler.getInstance(<span class="hljs-keyword">this</span>);
            LeCloudProxy.init(getApplicationContext());
            LeCloudPlayerConfig.getInstance().setDeveloperMode(<span class="hljs-keyword">true</span>).setIsApp();
        }
    }
}
</code></pre>
<h1 id="&#x521B;&#x5EFA;&#x64AD;&#x653E;&#x5668;">&#x521B;&#x5EFA;&#x64AD;&#x653E;&#x5668;</h1>
<p>&#x521B;&#x5EFA;<strong>PlayContext</strong></p>
<p><code>playContext</code>&#x662F;&#x64AD;&#x653E;&#x5668;&#x7684;&#x4E0A;&#x4E0B;&#x6587;&#xFF0C;&#x7528;&#x4E8E;&#x4FDD;&#x5B58;&#x64AD;&#x653E;&#x5668;&#x7684;&#x4E34;&#x65F6;&#x6570;&#x636E;&#x548C;&#x4E0A;&#x4E0B;&#x6587;</p>
<pre><code class="lang-java">    <span class="hljs-comment">/**
     * &#x521D;&#x59CB;&#x5316;PlayContext PlayContext&#x4F5C;&#x4E3A;&#x64AD;&#x653E;&#x5668;&#x7684;&#x4E0A;&#x4E0B;&#x6587;&#x800C;&#x5B58;&#x5728;&#xFF0C;&#x65E2;&#x4FDD;&#x5B58;&#x4E86;&#x64AD;&#x653E;&#x5668;&#x8FD0;&#x884C;&#x65F6;&#x7684;&#x4E34;&#x65F6;&#x6570;&#x636E;&#xFF0C;&#x4E5F;&#x8BB0;&#x5F55;&#x64AD;&#x653E;&#x5668;&#x6240;&#x9700;&#x8981;&#x7684;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x3002;
     */</span>
    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">initPlayContext</span><span class="hljs-params">()</span> </span>{
        playContext = <span class="hljs-keyword">new</span> PlayContext(<span class="hljs-keyword">this</span>);
        <span class="hljs-comment">//&#x5F53;&#x524D;&#x89C6;&#x9891;&#x6E32;&#x67D3;&#x6240;&#x4F7F;&#x7528;&#x7684;View&#xFF0C;&#x53EF;&#x80FD;&#x662F;Surfaceview(glSurfaceView&#x4E5F;&#x5C5E;&#x4E8E;Surfaceview ),&#x4E5F;&#x53EF;&#x80FD;&#x662F;textureView</span>
        playContext.setVideoContentView(videoView);
    }
</code></pre>
<p>&#x521B;&#x5EFA;letvplayer&#x5BF9;&#x8C61;&#xFF0C;&#x901A;&#x8FC7;<code>setPlayContext</code>&#x5173;&#x8054;playContext,&#x540C;&#x65F6;&#x5BF9;&#x64AD;&#x653E;&#x5668;&#x8FDB;&#x884C;&#x521D;&#x59CB;&#x5316;&#x64CD;&#x4F5C;&#x3002;
&#x5982;&#x679C;&#x6B64;&#x5904;SurfaceView&#x5DF2;&#x7ECF;&#x521B;&#x5EFA;&#x5B8C;&#x6BD5;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<code>setDisplay</code>&#x5C06;surface&#x8BBE;&#x7F6E;&#x5230;player&#x4E2D;</p>
<blockquote>
<p>&#x5173;&#x4E8E;<code>setDisplay()</code></p>
<p><code>SurfaceView</code>&#x521B;&#x5EFA;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x662F;&#x4E00;&#x4E2A;&#x5F02;&#x6B65;&#x8FC7;&#x7A0B;&#xFF0C;&#x6240;&#x4EE5;&#x6B64;&#x65F6;&#x5982;&#x679C;SurfaceView&#x7684;<code>onSurfaceCreated()</code>&#x6CA1;&#x6709;&#x56DE;&#x8C03;&#x7684;&#x8BDD;&#xFF0C;surface&#x53EF;&#x80FD;&#x662F;<code>null</code></p>
<p><code>setDisplay</code>&#x53EF;&#x4EE5;&#x5EF6;&#x8FDF;&#x5230;<code>ISplayer.MEDIA_EVENT_PREPARE_COMPLETE</code>&#x4E8B;&#x4EF6;&#x6536;&#x5230;&#x540E;&#xFF0C;<code>start</code>&#x4E4B;&#x524D;&#x8BBE;&#x7F6E;</p>
</blockquote>
<pre><code class="lang-java">    player = <span class="hljs-keyword">new</span> LetvPlayer();
    player.setPlayContext(playContext); <span class="hljs-comment">//&#x5173;&#x8054;playContext</span>
    player.init();
    <span class="hljs-keyword">if</span> (surface != <span class="hljs-keyword">null</span>) {
        player.setDisplay(surface);
    }
</code></pre>
<h1 id="&#x4E50;&#x89C6;&#x4E91;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;">&#x4E50;&#x89C6;&#x4E91;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;</h1>
<h2 id="&#x4E50;&#x89C6;&#x4E91;&#x70B9;&#x64AD;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;">&#x4E50;&#x89C6;&#x4E91;&#x70B9;&#x64AD;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;</h2>
<p>&#x901A;&#x8FC7;<code>setParameter</code>&#x65B9;&#x6CD5;&#xFF0C;&#x5C06;&#x70B9;&#x64AD;&#x6240;&#x9700;&#x8981;&#x7684;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&#x4E00;&#x4E0B;&#xFF0C;&#x64AD;&#x653E;&#x5668;&#x4F1A;&#x901A;&#x8FC7;&#x8FD9;&#x4E9B;&#x53C2;&#x6570;&#x8BF7;&#x6C42;&#x70B9;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;</p>
<pre><code class="lang-java">    Bundle bundle=<span class="hljs-keyword">new</span> Bundle();
    bundle.putInt(PlayProxy.PLAY_MODE, EventPlayProxy.PLAYER_VOD);<span class="hljs-comment">// &#x70B9;&#x64AD;&#x4E1A;&#x52A1;</span>
    bundle.putString(PlayProxy.PLAY_UUID, uu);
    bundle.putString(PlayProxy.PLAY_VUID, vu);
    bundle.putString(PlayProxy.PLAY_USERKEY, userKey);
    <span class="hljs-comment">// bundle.putString(PlayProxy.PLAY_SERVICE_NUMBER, &quot;&#x4E1A;&#x52A1;&#x7EBF;id&quot;);</span>
    <span class="hljs-comment">// bundle.putString(PlayProxy.PLAY_CUSTOMERID, &quot;&#x7528;&#x6237;id&quot;);</span>
    player.setParameter(player.getPlayerId(), bundle);
</code></pre>
<h2 id="&#x4E50;&#x89C6;&#x4E91;&#x76F4;&#x64AD;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;">&#x4E50;&#x89C6;&#x4E91;&#x76F4;&#x64AD;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;</h2>
<p>&#x901A;&#x8FC7;<code>setParameter</code>&#x65B9;&#x6CD5;&#xFF0C;&#x5C06;&#x76F4;&#x64AD;&#x6240;&#x9700;&#x8981;&#x7684;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&#x4E00;&#x4E0B;&#xFF0C;&#x64AD;&#x653E;&#x5668;&#x4F1A;&#x901A;&#x8FC7;&#x8FD9;&#x4E9B;&#x53C2;&#x6570;&#x8BF7;&#x6C42;&#x76F4;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;</p>
<p>&#x4F20;&#x5165;<code>liveid</code>&#x6216;&#x8005;&#x662F;<code>streamid</code></p>
<blockquote>
<p>LiveID&#x4E3E;&#x4F8B;&#xFF1A;201504213000012</p>
<p>StreamID&#x4E3E;&#x4F8B;&#xFF1A;20150421300001210</p>
<blockquote>
<p>&#x5982;&#x679C;&#x4E4B;&#x524D;&#x6709;&#x5BF9;&#x63A5;&#x8FC7;sdk3.0&#x7684;&#x5F00;&#x53D1;&#x8005;&#xFF0C;&#x4EE5;&#x524D;&#x4F7F;&#x7528;&#x4E86;streamid&#x662F;&#x7C7B;&#x4F3C;&#x8FD9;&#x6837;&#xFF1A;A2015111600547&#xFF0C;&#x90A3;&#x4E48;&#x5728;sdk4.0&#x4E2D;&#xFF0C;&#x5C06;&#x4F1A;&#x53D8;&#x6210;&#x4E50;&#x89C6;&#x4E91;&#x6D3B;&#x52A8;&#x76F4;&#x64AD;&#x53C2;&#x6570;&#xFF0C;&#x8BF7;&#x770B;&#x4E0B;&#x4E00;&#x8282;&#x7684;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;</p>
</blockquote>
</blockquote>
<pre><code class="lang-java">    Bundle bundle=<span class="hljs-keyword">new</span> Bundle();
    bundle.putInt(PlayProxy.PLAY_MODE, EventPlayProxy.PLAYER_LIVE);<span class="hljs-comment">// &#x76F4;&#x64AD;&#x4E1A;&#x52A1;</span>
    bundle.putString(PlayProxy.PLAY_LIVEID, liveId);
    <span class="hljs-comment">//bundle.putString(PlayProxy.PLAY_STREAMID,streamId);//streamId&#x6216;&#x8005;liveId,&#x4E8C;&#x9009;&#x4E00;</span>

    <span class="hljs-comment">//bundle.putBoolean(PlayProxy.PLAY_ISRTMP,isRtmp);//isRtmp&#x6216;&#x8005;isHls&#xFF0C;&#x4E8C;&#x9009;&#x4E00;</span>
    bundle.putBoolean(PlayProxy.PLAY_USEHLS, isHls);

    <span class="hljs-comment">//bundle.putBoolean(PlayProxy.PLAY_ISLETV, false);//&#x7528;&#x4E8E;&#x6807;&#x6CE8;&#x662F;&#x5426;&#x662F;&#x4E50;&#x89C6;&#x7F51;&#x7684;&#x89C6;&#x9891;</span>
    player.setParameter(player.getPlayerId(), bundle);
</code></pre>
<h2 id="&#x4E50;&#x89C6;&#x4E91;&#x6D3B;&#x52A8;&#x76F4;&#x64AD;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;">&#x4E50;&#x89C6;&#x4E91;&#x6D3B;&#x52A8;&#x76F4;&#x64AD;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;</h2>
<p>&#x901A;&#x8FC7;<code>setParameter</code>&#x65B9;&#x6CD5;&#xFF0C;&#x5C06;&#x76F4;&#x64AD;&#x6240;&#x9700;&#x8981;&#x7684;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&#x4E00;&#x4E0B;&#xFF0C;&#x64AD;&#x653E;&#x5668;&#x4F1A;&#x901A;&#x8FC7;&#x8FD9;&#x4E9B;&#x53C2;&#x6570;&#x8BF7;&#x6C42;&#x6D3B;&#x52A8;&#x76F4;&#x64AD;&#x76F8;&#x5173;&#x4E1A;&#x52A1;</p>
<p>&#x6D3B;&#x52A8;&#x76F4;&#x64AD;&#x9700;&#x8981;&#x6307;&#x5B9A;actionID</p>
<blockquote>
<p>ActionID&#x4E3E;&#x4F8B;:A2015111600547</p>
</blockquote>
<pre><code class="lang-java">Bundle mBundle = <span class="hljs-keyword">new</span> Bundle();
mBundle.putInt(PlayProxy.PLAY_MODE, EventPlayProxy.PLAYER_MUTI);
mBundle.putString(PlayProxy.PLAY_ACTIONID, <span class="hljs-string">&quot;actionid&quot;</span>);
<span class="hljs-comment">//mBundle.putBoolean(PlayProxy.PLAY_ISRTMP, isRtmp);isRtmp&#x6216;&#x8005;isHls&#xFF0C;&#x4E8C;&#x9009;&#x4E00;</span>
mBundle.putBoolean(PlayProxy.PLAY_USEHLS, isHls);
    <span class="hljs-comment">// mBundle.putString(PlayProxy.PLAY_SERVICE_NUMBER, &quot;&#x4E1A;&#x52A1;&#x7EBF;id&quot;);</span>
    <span class="hljs-comment">// mBundle.putString(PlayProxy.PLAY_CUSTOMERID, &quot;&#x7528;&#x6237;id&quot;);</span>
</code></pre>
<h1 id="&#x76D1;&#x542C;&#x64AD;&#x653E;&#x5668;&#x548C;&#x64AD;&#x653E;&#x5668;&#x51C6;&#x5907;">&#x76D1;&#x542C;&#x64AD;&#x653E;&#x5668;&#x548C;&#x64AD;&#x653E;&#x5668;&#x51C6;&#x5907;</h1>
<p>&#x8BBE;&#x7F6E;&#x64AD;&#x653E;&#x5668;&#x76D1;&#x542C;,&#x901A;&#x8FC7;&#x76D1;&#x542C;&#x63A5;&#x53E3;&#xFF0C;&#x64AD;&#x653E;&#x5668;&#x4F1A;<strong>&#x4E3B;&#x52A8;</strong>&#x5F97;&#x7ED9;&#x8C03;&#x7528;&#x8005;&#x53D1;&#x9001;&#x4E00;&#x7CFB;&#x5217;&#x7684;<strong>&#x4E8B;&#x4EF6;</strong>&#x3002;
&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x8FD9;&#x91CC;&#x5904;&#x7406;<strong>&#x64AD;&#x653E;&#x5668;&#x5F02;&#x5E38;</strong>&#xFF0C;<strong>&#x89C6;&#x9891;&#x64AD;&#x653E;&#x5B8C;&#x6BD5;</strong>&#x7B49;&#x4E8B;&#x4EF6;&#x3002;</p>
<blockquote>
<p>&#x5173;&#x4E8E;&#x64AD;&#x653E;&#x5668;&#x4E8B;&#x4EF6;,&#x8BF7;&#x67E5;&#x770B;<a href="../part1/player_api_Intro.html">LePlayer&#x64AD;&#x653E;&#x5668;Api&#x8BF4;&#x660E;</a></p>
</blockquote>
<pre><code class="lang-java">    player.setOnPlayStateListener(<span class="hljs-keyword">new</span> OnPlayStateListener() {
            <span class="hljs-annotation">@Override</span>
            <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">videoState</span><span class="hljs-params">(<span class="hljs-keyword">int</span> state, Bundle bundle)</span> </span>{
                <span class="hljs-keyword">if</span> (player == <span class="hljs-keyword">null</span>) {
                    <span class="hljs-keyword">return</span>;
                }
                <span class="hljs-keyword">switch</span> (state) {
                <span class="hljs-keyword">case</span> ISplayer.MEDIA_EVENT_PREPARE_COMPLETE:
                    player.start();
                    <span class="hljs-keyword">break</span>;
                ......
                }
            }
        });
</code></pre>
<p>&#x64AD;&#x653E;&#x5668;&#x5F00;&#x59CB;&#x51C6;&#x5907;&#xFF0C;&#x8FD9;&#x65F6;&#x5019;&#x5F00;&#x59CB;&#x8FDB;&#x884C;&#x9A8C;&#x8BC1;&#x548C;&#x94FE;&#x63A5;&#x5A92;&#x4F53;&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x5F53;&#x51C6;&#x5907;&#x5B8C;&#x6210;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x64AD;&#x653E;&#x5668;&#x4F1A;&#x76D1;&#x542C;&#x5230;&#x76D1;&#x542C;&#x5B8C;&#x6210;&#x4E8B;&#x4EF6;&#xFF1A;<code>ISplayer.MEDIA_EVENT_PREPARE_COMPLETE</code>&#x3002;&#x6B64;&#x65F6;&#x53EF;&#x4EE5;&#x6267;&#x884C;<code>start()</code></p>
<pre><code class="lang-java">    <span class="hljs-comment">//if (lastPosition &gt; 0) {</span>
    <span class="hljs-comment">//    player.seekTo(lastPosition);</span>
    <span class="hljs-comment">//}</span>
    player.prepareAsync();
</code></pre>
<blockquote>
<p>&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#x7EE7;&#x7EED;&#x64AD;&#x653E;??</p>
<p><strong>1)</strong> &#x5728;<code>stop</code>&#x65B9;&#x6CD5;&#x4E4B;&#x524D;&#x83B7;&#x53D6;&#x5230;&#x9000;&#x51FA;&#x65F6;&#x7684;&#x6700;&#x540E;&#x64AD;&#x653E;&#x65F6;&#x95F4;</p>
<pre><code class="lang-java">   lastPosition=player.getCurrentPosition();
   player.stop();
   ......
</code></pre>
<p><strong>2)</strong> &#x5728;<code>prepareAsync</code>&#x4E4B;&#x524D;&#xFF0C;&#x5C06;&#x4E0A;&#x6B21;&#x64AD;&#x653E;&#x901A;&#x8FC7;<code>seekTo</code>&#x65B9;&#x6CD5;&#x8BBE;&#x7F6E;</p>
<pre><code class="lang-java">    <span class="hljs-keyword">if</span> (lastPosition &gt; <span class="hljs-number">0</span>) {
        player.seekTo(lastPosition);
    }
    player.prepareAsync();
</code></pre>
</blockquote>
<h1 id="&#x9500;&#x6BC1;&#x64AD;&#x653E;&#x5668;">&#x9500;&#x6BC1;&#x64AD;&#x653E;&#x5668;</h1>
<p>&#x5F53;&#x9700;&#x8981;&#x7ED3;&#x675F;&#x64AD;&#x653E;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x9700;&#x8981;&#x9500;&#x6BC1;&#x64AD;&#x653E;&#x5668;&#x8D44;&#x6E90;</p>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">stopPlayer</span><span class="hljs-params">()</span></span>{
    <span class="hljs-keyword">if</span>(player!=<span class="hljs-keyword">null</span>){
        player.stop();
        player.release();
        player=<span class="hljs-keyword">null</span>;
    }
}
</code></pre>
<h1 id="&#x91CA;&#x653E;&#x8D44;&#x6E90;">&#x91CA;&#x653E;&#x8D44;&#x6E90;</h1>
<p>&#x5728;Activity <code>onDestry()</code>&#x7684;&#x65F6;&#x5019;,playContext&#x9700;&#x8981;&#x91CA;&#x653E;</p>
<pre><code class="lang-java">    <span class="hljs-keyword">if</span> (playContext != <span class="hljs-keyword">null</span>) {
            playContext.destory();
        }
</code></pre>
<h1 id="&#x91CA;&#x653E;&#x670D;&#x52A1;">&#x91CA;&#x653E;&#x670D;&#x52A1;</h1>
<p>&#x5728;&#x5E94;&#x7528;&#x9000;&#x51FA;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x91CA;&#x653E;&#x6389;&#x4E50;&#x89C6;&#x4E91;&#x670D;&#x52A1;</p>
<pre><code class="lang-java">  LeCloudProxy.destory();
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../part0/demoyun_xing_xiao_guo_ji_shi_yong.html" class="navigation navigation-prev " aria-label="Previous page: demo运行效果及使用"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../part0/handle_video_ratio.html" class="navigation navigation-next " aria-label="Next page: 处理视频比例"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
